#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import requests
import os
import time

dkURL = os.getenv('DK_HOST')
if dkURL is None:
    dkURL = "127.0.0.1"
print("Datakit URL:", dkURL)

dkPort = os.getenv('DK_PORT')
if dkPort is None:
    dkPort = "9529"
print("Datakit Port:", dkPort)

url = 'http://' + dkURL + ':' + dkPort + '/v1/write/logstreaming?tags=key1=value1,key2=value2'
print("Total URL Path:", url)

while True:
    x = requests.post(url, data='456')
    print(x.text)

    myobj = {'abc': '789'}
    x = requests.post(url, json = myobj)
    print(x.text)

    time.sleep( 1 )
